package smy.att;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class Helper {
	public static String ReadInputStream(InputStream is) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		StringBuilder  builder = new StringBuilder();
		String         line;
		while ((line = reader.readLine()) != null) {
			builder.append(line);
			builder.append('\n');
		}
		return builder.toString();
	}
	
	public static <T> T[] Join(T[] a, T[] b) {
		ArrayList<T> result = new ArrayList<T>();
		result.addAll(Arrays.asList(a));
		result.addAll(Arrays.asList(b));
		return result.toArray(a);
	}
	
	public static <T> T[] Join(T a , T[] b) {
		ArrayList<T> result = new ArrayList<T>();
		result.add(a);
		result.addAll(Arrays.asList(b));
		return result.toArray(b);
	}
}
